//
//  HomeChooseAreaAlertTableViewCell.m
//  ZJControlsClass
//
//  Created by mac on 2024/11/24.
//

#import "HomeChooseAreaAlertTableViewCell.h"

@implementation HomeChooseAreaAlertTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self){
        
        [self configUI];
    }
    return self;
}

-(void)configUI{
    [self.contentView addSubview:self.chooseBtn];
    [self.contentView addSubview:self.areaLabel];
    [self.contentView addSubview:self.img];

    [self.chooseBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).with.offset(ALIGN_WIDTH_PT(10));
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.size.equalTo(@(CGSizeMake(ALIGN_WIDTH_PT(20), ALIGN_WIDTH_PT(20))));
    }];
    
    [self.areaLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.left.equalTo(self.chooseBtn.mas_right).with.offset(ALIGN_WIDTH_PT(5));
        make.right.equalTo(self.contentView).with.offset(-ALIGN_WIDTH_PT(15));
    }];
    
    [self.img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.right.equalTo(self.contentView).with.offset(-ALIGN_WIDTH_PT(5));
        make.size.equalTo(@(CGSizeMake(ALIGN_WIDTH_PT(6), ALIGN_HEIGHT_PT(11))));
    }];
    
    
}

-(void)respondsTo_chooseBtn:(UIButton *)sender{
 
    !_chooseDispatchBlock ?: _chooseDispatchBlock();
    
}




#pragma mark -- 懒加载
-(UIButton *)chooseBtn{
    if (!_chooseBtn){
        _chooseBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
        [_chooseBtn setImage:[UIImage imageNamed:@"未选"] forState:(UIControlStateNormal)];
        [_chooseBtn addTarget:self action:@selector(respondsTo_chooseBtn:) forControlEvents:(UIControlEventTouchUpInside)];
    }
    return _chooseBtn;
}

-(UILabel *)areaLabel{
    if (!_areaLabel){
        _areaLabel = [UILabel new];
        _areaLabel.textColor = [UIColor blackColor];
        _areaLabel.font = FONT14;
        _areaLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _areaLabel;
}

-(UIImageView *)img{
    if (!_img){
        _img = [UIImageView new];
        _img.image = [UIImage imageNamed:@"向右箭头"];
    }
    return _img;
}






@end
